using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class PathfindingGridDebugObject : GridDebugObject
{
    [SerializeField] private TextMeshProUGUI gConstText;
    [SerializeField] private TextMeshProUGUI hConstText;
    [SerializeField] private TextMeshProUGUI fConstText;
    [SerializeField] private SpriteRenderer isWalkableSpriteRenderer;

    private PathNode pathNode;

    public override void SetGridObject(object gridObject)
    {
        base.SetGridObject(gridObject);
        pathNode = (PathNode)gridObject;
    }

    protected override void Update()
    {
        base.Update();
        gConstText.text = pathNode.GetGCost().ToString();
        hConstText.text = pathNode.GetHCost().ToString();
        fConstText.text = pathNode.GetFCost().ToString();
        isWalkableSpriteRenderer.color=pathNode.IsWalkable()?Color.green:Color.red;
    }

}
